<?php echo $this->load->view('meta'); ?>
<title>xa-ncsu | praise</title>
<?php echo $this->load->view('header'); ?>
<p><?php echo anchor('praise', 'back to praise');?>
<div class="entry">
	<?php echo $this->validation->error_string;?>
	<div class="entry-title">
		<h2><?php echo $post->title?></h2>
		<p class="author"><?php echo $post->author?></p>
		<p class="posted"><?php echo $post->posted?></p>
	</div>
	<div class="entry-body"><?php echo $post->body?></div>
<?php //if (isset($loggedin)) : ?>
	<?php if ($comments->num_rows() > 0) : ?>	
		<p>Responses:</p>
		<?php foreach ($comments->result() as $comment) : ?>
		<?php if($comment->approved === 'y' || $this->badger->checkMember('admin xalt')) : ?>
			<div class="comment">
				<span class="right"><?php echo $comment->edit?></span>
				<span><?php echo $comment->author?> - <?php echo $comment->posted?></span>
				<p><?php echo $comment->body?></p>
				<?php if($comment->approved === 'n'):?><br /><p><?php echo $comment->approve;?></p><?php endif; ?>
				<?php if($comment->edited != NULL):?><br /><p class="edited">edited by <?php echo $comment->editor?> on <?php echo $comment->edited?></p><?php endif; ?>
			</div>
		<?php endif; ?>
		<?php endforeach; ?>
	<?php else: ?>
		<p><strong>No Responses</strong></p>
	<?php endif; ?>
	</div>
	
	<?php echo form_open('praise/post/' . $this->uri->segment(3));?>
	<fieldset>
		<legend>post a comment</legend>
		<ol class="fivehundred">
			<li><label for="name">name</label>
				<input type="input" name="authorname" value="<?php echo (isset($loggedin)) ? $con_user->display : $this->validation->authorname;?>" /></li>
			<li><label for="body">comment</label>
				<textarea name="body" rows="10" value="<?php echo $this->validation->body;?>"></textarea></li>
			<li><?php echo form_hidden('postid', $this->uri->segment(3));?></li>
			<li><?php echo form_submit('','submit');?><span class="email"><input type="input" name="email" /></span></li>
		</ol>
	</fieldset>
	</form>
<?php //else: ?>
<?php //<p>You must login to view and post comments.</p>
//	</div>?>
<?php // endif; ?>
<?php echo $this->load->view('footer'); ?>
